package com.hup.utils.io.netty.model;

import com.hup.utils.io.netty.NettyConstant.DataType;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

/**
 * {@link DataType#LOGIN_RESPONSE}
 *
 * @author hugan
 * @date 2021/5/1
 */
@ToString
public class LoginResponsePacket implements BaseDataPacket {

    @Setter
    @Getter
    private boolean success = true;

    @Setter
    @Getter
    private String errorMessage;

    @Override
    public int getType() {
        return DataType.LOGIN_RESPONSE;
    }

    public static LoginResponsePacket failure(String msg) {
        LoginResponsePacket res = new LoginResponsePacket();
        res.success = false;
        res.errorMessage = msg;
        return res;
    }

}
